package com.springinaction.ch04.noargsxml;

import org.aspectj.lang.ProceedingJoinPoint;



public class Audience {

    public void silenceCellPhones(){
        System.out.println("Silence cell phones");
    }

    public void takeSeats(){
        System.out.println("Taking seats");
    }

    public void applause(){
        System.out.println("CLAP CLAP CLAP!!!");
    }

    public void demandRefund(){
        System.out.println("Demanding a refund");
    }

    public void watchPerformance(ProceedingJoinPoint pj){
       try {
           try {
               System.out.println("Silence cell phones");
               pj.proceed();
           }finally {
               System.out.println("Taking seats");
           }
           System.out.println("CLAP CLAP CLAP!!!");

       }catch (Throwable e){
           System.out.println("Demanding a refund");
       }
   }

}
/* 执行顺序
try{
    try{
        //@Before
        method.invoke(..);
    }finally{
        //@After
    }
    //@AfterReturning
}catch(){
    //@AfterThrowing
}

 */